In a two-dimensional code, square elements (also called modules) having predetermined sizes are arranged in two-dimension (horizontally and vertically) to form a grid-like pattern, and an arrangement of bright and dark (white or black) modules represents a piece of data. To decode such a two-dimensional code, positions of individual modules in a captured image are correctly determined, then black or white at the positions are correctly determined.
A two-dimensional code includes a mark having a predetermined specific form that makes detection of positions of modules easy with high precision. A position detection pattern in a QR code (trademark) and a finder pattern in a DataMatrix (trademark) are examples of the marks.
Also, a two-dimensional code includes a pattern in which predetermined-sized black/white modules are alternately arranged along a straight line. Such a pattern is called a “timing pattern” that represents physical characteristics of the data such as the code size or the module size.
FIGS. 1A-1B are schematic views illustrating examples of two-dimensional codes. FIG. 1A is an example of a DataMatrix (trademark). A pattern 11 illustrated in FIG. 1A is a timing pattern, and a pattern 12 illustrated in FIG. 1A is a finder pattern.
FIG. 1B is an example of a QR code (trademark). A pattern 13 illustrated in FIG. 1B is a timing pattern similar to FIG. 1A. A pattern 14 illustrated in FIG. 1B is a position detection pattern.
To detect such patterns illustrated in FIGS. 1A-1B with high precision, it is important to locate the position of the external boundary line of a code. To detect the code boundary with high speed, there is a technology that recognizes white pixels arranged on a straight line outside of a code boundary as a code boundary.
FIG. 2 is a schematic view illustrating such a conventional method of detecting a boundary line. As illustrated in FIG. 2, scanning starts from a point 15 in a code, directing outwards, and detects a position from which white pixels are arranged continuously, and the position is recognized as being on a boundary line. Also, there are various technologies to capture two-dimensional codes.